Numerical simulation is widely used in industrial fields as a method of simulating a physical system by using a computer. In most cases, there is desire to model the transport processes occurring in the physical system. What is being transported is typically mass, energy, momentum, or some combination thereof. By using numerical simulation, it is possible to model and observe a physical phenomenon and to determine design parameters, without actual laboratory experiments and field tests.
Reservoir simulation is of great interest because it infers the behavior of a real hydrocarbon-bearing reservoir from the performance of a model of that reservoir. The typical objective of reservoir simulation is to understand the complex chemical, physical, and fluid flow processes occurring in the reservoir sufficiently well to predict future behavior of the reservoir to maximize hydrocarbon recovery. Reservoir simulation often refers to the hydrodynamics of flow within a reservoir, but in a larger sense reservoir simulation can also refer to the total hydrocarbon system which can include not only the reservoir, but also injection wells, production wells, surface flowlines, associated aquifers, and surface processing facilities. Reservoir simulation calculations in such hydrocarbon systems are based on fluid flow through the entire hydrocarbon system being simulated. These calculations are performed with varying degrees of rigor, depending on the requirements of the particular simulation study and the capabilities of the simulation software being used.
The principle of numerical simulation is to numerically solve equations describing a physical phenomenon using a computer. Such equations are generally ordinary differential equations and partial differential equations. As a means for numerically solving such equations, there are known the finite element method, the finite difference method, the finite volume method, and the like. Regardless of which method is used, the physical system to be modeled is divided into cells (a set of which is called a grid or mesh), and the state variables that vary in space throughout the model are represented by sets of values for each cell. The reservoir rock properties such as porosity and permeability are typically assumed to be constant inside a cell. Other variables such as fluid pressure and phase saturation are specified at specified points, sometimes called nodes, within the cell. A link between two nodes is called a “connection.”
Since the reservoir simulation can include vastly different fluid flow environments (e.g., porous rock, well tubing, processing facilities), the set of cells can include multiple segments of different flow environments. Although individual segments, such as production facilities and surface pipe segments, could be represented by single cells, at times reservoir simulation programs subdivide such segments into multiple cells.
A set of equations is developed to express the fundamental principles of conservation of mass, energy, and/or momentum within each cell and of movement of mass, energy, and/or momentum between cells. These equations can number in the millions. The replacement of state variables that vary in space throughout a model by a finite number of variable values for each cell is called “discretization”. In order to analyze a phenomenon changing in time, it is necessary to calculate physical quantities at discrete intervals of time called timesteps, irrespective of the continuously changing conditions as a function of time. Time-dependent modeling of the transport processes therefore proceeds in a sequence of timesteps. The simulation of flow during a desired period of time is done by incrementally moving forward through time, and solving the equations at each timestep for the pressure and fluid contents of every node.
Efforts have been made to perform widely varying reservoir simulation methods in a single computer code. However, such “general-purpose” simulation systems are very complex, largely because they are designed to have one or more of the following capabilities:                (1) represent many different types of cells (e.g., different domains of a reservoir, well tubing, and surface gathering and distribution facilities, and surface processing facilities);        (2) use different timestep computation methods (e.g., IMPES, fully implicit, sequential implicit, adaptive implicit, and/or cascade methods);        (3) use different ways of representing reservoir fluids;        (4) use multiple ways of computing transport between cells;        (5) perform what is called a “black-oil model,” which treats the hydrocarbons as being made up of two components, and also having the capability of performing compositional representations in which the hydrocarbons are assumed to contain compounds such as methane, ethane, propane, and heavier hydrocarbons;        (6) simulate steam injection or in situ combustion processes, which must take into account temperature changes as a function of time which require an energy balance and related calculations;        (7) simulate miscible recovery processes using special fluid properties and transport calculations;        (8) simulate hydrocarbon recovery processes that take into account injection of surfactants, polymers, or other chemicals and the flow of these fluids into the reservoir;        (9) simulate injection of chemicals that react with each other, the reservoir hydrocarbons, or the reservoir rock; and        (10) simulate migration of hydrocarbons and geologic deposition over geologic time.        
Historically, because general-purpose simulation systems are complex, reservoir simulation programs typically either model only fluid movement in the subsurface reservoir or they model the subsurface fluid movement and include simplified calculations, for example, hydraulics models, to model flow within well tubulars between the reservoir and the surface. To more realistically model the flow through the wells and in attached surface production facilities (such as manifolds, pumps, compressors, separators and pipelines) has typically required a separate facilities simulation model that is distinct from the reservoir simulation model. Since these reservoir and facilities simulation models attempt to describe the flow behavior over a long period of time, typically many years, and the simulations are discretized into timesteps that cover the desired simulation period, it is cumbersome and costly to try to devise an integrated modeling process based on two distinct models. Such a process usually involves alternating timesteps between the two models, such that the changes that occur in one model can be incorporated into the input for the subsequent timestep of the second model.
One challenging problem in reservoir simulation in the past has been the lack of rigorous modeling of transport phenomena through well tubulars and surface facilities within a reservoir simulation system. Conventional reservoir simulators typically have two significant limitations. First, many reservoir management studies require a more sophisticated surface facilities flow model than is possible in a reservoir simulator. To address this problem, the simulator user typically develops and maintains one simulation model for the reservoir behavior and another simulation model for the facilities behavior, with no convenient way to integrate the results from the two models, or to easily evaluate the effects of change in one model on the behavior of the other. Second, reservoir management typically involves dramatic changes in well or facility rates. Since facility rates are used as boundary conditions for reservoir simulation calculations, dramatic changes in those boundary conditions often lead to numerical instabilities in the simulation calculations that are difficult to manage.
Another challenging problem in reservoir simulation is the ability of a simulator user to specify facility management logic in the simulation. To optimize the production of hydrocarbons from a field requires a continuous process to monitor and control the production and injection facilities during the life of the field, which can span up to 30 or more years. To more accurately predict the behavior of the reservoir using a reservoir simulator requires that the impact of surface facility controls be taken into consideration during the simulation. The specific controls, and their sequence and timing, is difficult, if not practically impossible, to program into the simulator because the permutations would be limitless and depend on each field and each simulator user's approach to managing the field. Therefore, the reservoir simulator user needs a tool to be able to specify to the simulator the custom checks and controls that the simulator user believes will optimize the production of the reservoir. Those checks and controls then need to become an integral part of simulator computations. In short, an intuitive tool is needed to capture each simulator user's custom facility management logic, turn that into executable code that is integrated with the reservoir simulator's code, and then execute the resulting system to predict the overall behavior of the reservoir during its lifetime.
The typical approach to this problem has been the development of software that provides a user with a structured capability. The simulator user is provided with a text-based editor or interface wherein he or she has available a set of constructs and a fixed set of keywords. Using the constructs, the simulator user can define potential conditions, which if met during the simulation, trigger some response that modifies the behavior of the wells. This approach is not very intuitive for the user. The process of assembling the constructs and keywords can be tedious, and the result is not easy to read or interpret, particularly for persons not originally involved with the reservoir project. There is no clear overview of the logic, meaning that it is not easy to follow the high-level line of reasoning behind the logic. The user has limited control over the process and the remedies available for execution are limited by a finite set of combinations that the simulator recognizes, resulting in limited flexibility of the system to accommodate unconventional reservoir management strategies.
There is a need in the industry for a reservoir simulation system that (1) provides a more realistic model of flow through well tubulars and surface facilities and (2) captures a facility management logic customized by a reservoir simulator user and executes it as part of a reservoir simulation.